<!DOCTYPE html>
<html lang="zh-CN">
  <head>
  <meta charset="UTF-8">
  <meta 
    name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  <meta 
    http-equiv="X-UA-Compatible" 
    content="ie=edge">
  <meta 
    name="theme-color" 
    content="#fff" 
    id="theme-color">
  <meta 
    name="description" 
    content="hexoDemo用于介绍如何使用hexo">
  <link 
    rel="icon" 
    href="/">
  <title>00-服务器分类及PHP入门</title>
  
    
      <meta 
        property="og:title" 
        content="00-服务器分类及PHP入门">
    
    
      <meta 
        property="og:url" 
        content="https://zwl5670.gitee.io/2006/06/01/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/00-%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB%E5%8F%8APHP%E5%85%A5%E9%97%A8/index.html">
    
    
      <meta 
        property="og:img" 
        content="https://img.songhn.com/img/Y67gdd.png">
    
    
      <meta 
        property="og:img" 
        content="hexoDemo用于介绍如何使用hexo">
    
    
      <meta 
        property="og:type" 
        content="article">
      <meta 
        property="og:article:published_time" 
        content="2006-06-01">
      <meta 
        property="og:article:modified_time" 
        content="2023-03-14">
      <meta 
        property="og:article:author" 
        content="zwl5670">
      
        
          <meta 
            property="og:article:tag" 
            content="JS基础异步">
        
      
    
  
  
  <link rel="preload" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css" as="style" >
  <link rel="preload" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css" as="style" >
  <link rel="preload" href="/css/main.css" as="style" >
  
  <link rel="modulepreload" href="//instant.page/5.1.0">
  
  <link rel="stylesheet" href="/css/main.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css">
  
  
  
    <link rel="stylesheet" href="/js/lib/lightbox/baguetteBox.min.css">
  
  <script>
    function loadScript(url, cb) {
      var script = document.createElement('script');
      script.src = url;
      if (cb) script.onload = cb;
      script.async = true;
      document.body.appendChild(script);
    }
    function loadCSS(href, data, attr) {
      var sheet = document.createElement('link');
      sheet.ref = 'stylesheet';
      sheet.href = href;
      sheet.dataset[data] = attr;
      document.head.appendChild(sheet);
    }
    function changeCSS(cssFile, data, attr) {
      var oldlink = document.querySelector(data);
      var newlink = document.createElement("link");
      newlink.setAttribute("rel", "stylesheet");
      newlink.setAttribute("href", cssFile);
      newlink.dataset.prism = attr;
      document.head.replaceChild(newlink, oldlink);
    }
  </script>
  
    
  
  <script>
    // control reverse button
    var reverseDarkList = {
      dark: 'light',
      light: 'dark'
    };
    var themeColor = {
      dark: '#1c1c1e',
      light: '#fff'
    }
    // get the data of css prefers-color-scheme
    var getCssMediaQuery = function() {
      return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
    };
    // reverse current darkmode setting function
    var reverseDarkModeSetting = function() {
      var setting = localStorage.getItem('user-color-scheme');
      if(reverseDarkList[setting]) {
        setting = reverseDarkList[setting];
      } else if(setting === null) {
        setting = reverseDarkList[getCssMediaQuery()];
      } else {
        return;
      }
      localStorage.setItem('user-color-scheme', setting);
      return setting;
    };
    // apply current darkmode setting
  </script>
  
    <script>
      var setDarkmode = function(mode) {
      var setting = mode || localStorage.getItem('user-color-scheme');
      if(setting === getCssMediaQuery()) {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else if(reverseDarkList[setting]) {
        document.documentElement.setAttribute('data-user-color-scheme', setting);
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[getCssMediaQuery()];
        document.getElementById('theme-color').dataset.mode = getCssMediaQuery();
      }
    };
    setDarkmode();
    </script>
  
  
  
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.js" as="script">
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lozad.min.js" as="script">
  
  
  
  
  
  
<meta name="generator" content="Hexo 6.3.0"></head>

  <body>
    <div class="wrapper">
       
      <nav class="navbar">
  <div class="navbar-logo">
    <a class="navbar-logo-main" href="/">
      
      <span class="navbar-logo-dsc">前端面试</span>
      </a>
  </div>
  <div class="navbar-menu">
    
      <a 
        href="/" 
        class="navbar-menu-item">
        
          首页
        
      </a>
    
      <a 
        href="/archives" 
        class="navbar-menu-item">
        
          归档
        
      </a>
    
      <a 
        href="/tags" 
        class="navbar-menu-item">
        
          标签
        
      </a>
    
      <a 
        href="/categories" 
        class="navbar-menu-item">
        
          分类
        
      </a>
    
      <a 
        href="/about" 
        class="navbar-menu-item">
        
          关于
        
      </a>
    
      <a 
        href="/links" 
        class="navbar-menu-item">
        
          友链
        
      </a>
    
    <button 
      class="navbar-menu-item darknavbar navbar-menu-btn" 
      aria-label="Toggle dark mode"
      id="dark">
      <i class="iconfont icon-weather"></i>
    </button>
    <button 
      class="navbar-menu-item searchnavbar navbar-menu-btn" 
      aria-label="Toggle search"
      id="search">
      <!-- <i 
        class="iconfont icon-search" 
        style="font-size: 1.2rem; font-weight: 400;">
      </i> -->
      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img"
        class="iconify iconify--ion" width="28" height="28" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512">
        <path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="28"
          d="M256 80a176 176 0 1 0 176 176A176 176 0 0 0 256 80Z"></path>
        <path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="28"
          d="M232 160a72 72 0 1 0 72 72a72 72 0 0 0-72-72Z"></path>
        <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="28"
          d="M283.64 283.64L336 336"></path>
      </svg>
    </button>
  </div>
</nav> 
      
      <div 
        id="local-search" 
        style="display: none">
        <input
          class="navbar-menu-item"
          id="search-input"
          placeholder="请输入搜索内容..." />
        <div id="search-content"></div>
      </div>
      
      <div class="section-wrap">
        <div class="container">
          <div class="columns">
            <aside class="left-column">
              
              <div class="card card-author">
                
  <img 
    src="https://img.songhn.com/img/Y67gdd.png" 
    class="author-img"
    width="88"
    height="88"
    alt="author avatar">

<p class="author-name">zwl5670</p>
<p class="author-description">前端学习资料</p>
<div class="author-message">
  <a 
    class="author-posts-count" 
    href="/archives">
    <span>215</span>
    <span>文章</span>
  </a>
  <a 
    class="author-categories-count" 
    href="/categories">
    <span>14</span>
    <span>分类</span>
  </a>
  <a 
    class="author-tags-count" 
    href="/tags">
    <span>14</span>
    <span>标签</span>
  </a>
</div>

              </div>
               <div class="sticky-tablet">
  
  
    <article class="display-when-two-columns spacer">
      <div class="card card-content toc-card">
        <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#C-x2F-S%E6%9E%B6%E6%9E%84%E5%92%8CB-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">C&#x2F;S架构和B&#x2F;S架构</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#C-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">C&#x2F;S架构</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#B-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">B&#x2F;S架构</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB"><span class="toc-text">服务器分类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%B1%BB%E5%9E%8B"><span class="toc-text">服务器类型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%BD%AF%E4%BB%B6"><span class="toc-text">服务器软件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-WampServer-%E6%90%AD%E5%BB%BA-HTTP%E6%9C%8D%E5%8A%A1"><span class="toc-text">使用 WampServer 搭建 HTTP服务</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%9B%86%E6%88%90%E7%8E%AF%E5%A2%83%E7%9A%84%E5%88%86%E7%B1%BB"><span class="toc-text">集成环境的分类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#WampServer-%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-text">WampServer 的安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95%E8%AE%BF%E9%97%AE"><span class="toc-text">测试访问</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E7%BD%91%E7%AB%99%E6%A0%B9%E7%9B%AE%E5%BD%95"><span class="toc-text">配置网站根目录</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%9D%99%E6%80%81%E7%BD%91%E7%AB%99%E5%92%8C%E5%8A%A8%E6%80%81%E7%BD%91%E7%AB%99"><span class="toc-text">静态网站和动态网站</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#PHP%E7%9A%84%E5%B8%B8%E8%A7%81%E8%AF%AD%E6%B3%95"><span class="toc-text">PHP的常见语法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%AC%AC%E4%B8%80%E6%AE%B5-php-%E4%BB%A3%E7%A0%81"><span class="toc-text">第一段 php 代码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B3%A8%E9%87%8A"><span class="toc-text">注释</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%98%E9%87%8F"><span class="toc-text">变量</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="toc-text">数据类型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%90%E7%AE%97%E7%AC%A6"><span class="toc-text">运算符</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%87%BD%E6%95%B0%E7%9A%84%E5%AE%9A%E4%B9%89"><span class="toc-text">函数的定义</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%B1%BB%E5%92%8C%E5%AF%B9%E8%B1%A1"><span class="toc-text">类和对象</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%86%85%E5%AE%B9%E8%BE%93%E5%87%BA"><span class="toc-text">内容输出</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5"><span class="toc-text">循环语句</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php%E4%B8%AD%E7%9A%84header-%E5%87%BD%E6%95%B0"><span class="toc-text">php中的header()函数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php%E4%B8%AD%E7%9A%84-get-%E8%AF%B7%E6%B1%82%E5%92%8C-post-%E8%AF%B7%E6%B1%82"><span class="toc-text">php中的 get 请求和 post 请求</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#get-%E8%AF%B7%E6%B1%82"><span class="toc-text">get 请求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#post-%E8%AF%B7%E6%B1%82"><span class="toc-text">post 请求</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php-%E4%B8%AD%E6%96%87%E4%BB%B6%E7%9B%B8%E5%85%B3%E7%9A%84%E6%93%8D%E4%BD%9C"><span class="toc-text">php 中文件相关的操作</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0-FILES"><span class="toc-text">文件上传 $_FILES</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%BF%9D%E5%AD%98"><span class="toc-text">文件保存</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#WampServer-%E4%B8%AD%E4%BF%AE%E6%94%B9%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6%E7%9A%84%E5%A4%A7%E5%B0%8F"><span class="toc-text">WampServer 中修改上传文件的大小</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTTP-%E5%8D%8F%E8%AE%AE"><span class="toc-text">HTTP 协议</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AF%B7%E6%B1%82"><span class="toc-text">请求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%93%8D%E5%BA%94"><span class="toc-text">响应</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8A%93%E5%8C%85%E5%B7%A5%E5%85%B7"><span class="toc-text">抓包工具</span></a></li></ol></li></ol>
      </div>
    </article>
  
  
  <article class="card card-content categories-widget">
    <div class="categories-card">
  <div class="categories-header">
    <i 
      class="iconfont icon-fenlei" 
      style="padding-right: 2px;">
    </i>分类
  </div>
  <div class="categories-list">
    
      <a href="/categories/%E5%89%8D%E7%AB%AF%E5%B7%A5%E5%85%B7/">
        <div class="categories-list-item">
          前端工具
          <span class="categories-list-item-badge">13</span>
        </div>
      </a>
    
      <a href="/categories/CSS%E5%9F%BA%E7%A1%80/">
        <div class="categories-list-item">
          CSS基础
          <span class="categories-list-item-badge">18</span>
        </div>
      </a>
    
      <a href="/categories/CSS%E8%BF%9B%E9%98%B6/">
        <div class="categories-list-item">
          CSS进阶
          <span class="categories-list-item-badge">9</span>
        </div>
      </a>
    
      <a href="/categories/HTML/">
        <div class="categories-list-item">
          HTML
          <span class="categories-list-item-badge">12</span>
        </div>
      </a>
    
      <a href="/categories/JS%E5%9F%BA%E7%A1%80/">
        <div class="categories-list-item">
          JS基础
          <span class="categories-list-item-badge">56</span>
        </div>
      </a>
    
      <a href="/categories/JS%E5%9F%BA%E7%A1%80ES6/">
        <div class="categories-list-item">
          JS基础ES6
          <span class="categories-list-item-badge">10</span>
        </div>
      </a>
    
      <a href="/categories/JS%E5%9F%BA%E7%A1%80%E5%BC%82%E6%AD%A5/">
        <div class="categories-list-item">
          JS基础异步
          <span class="categories-list-item-badge">11</span>
        </div>
      </a>
    
      <a href="/categories/JS%E8%BF%9B%E9%98%B6/">
        <div class="categories-list-item">
          JS进阶
          <span class="categories-list-item-badge">11</span>
        </div>
      </a>
    
      <a href="/categories/%E7%A7%BB%E5%8A%A8web/">
        <div class="categories-list-item">
          移动web
          <span class="categories-list-item-badge">3</span>
        </div>
      </a>
    
      <a href="/categories/CSS%E5%92%8CDOM/">
        <div class="categories-list-item">
          CSS和DOM
          <span class="categories-list-item-badge">6</span>
        </div>
      </a>
    
      <a href="/categories/Node/">
        <div class="categories-list-item">
          Node
          <span class="categories-list-item-badge">16</span>
        </div>
      </a>
    
      <a href="/categories/Vue%E5%9F%BA%E7%A1%80/">
        <div class="categories-list-item">
          Vue基础
          <span class="categories-list-item-badge">15</span>
        </div>
      </a>
    
      <a href="/categories/%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/">
        <div class="categories-list-item">
          性能优化
          <span class="categories-list-item-badge">7</span>
        </div>
      </a>
    
      <a href="/categories/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/">
        <div class="categories-list-item">
          前端工程化
          <span class="categories-list-item-badge">8</span>
        </div>
      </a>
    
  </div>
</div>
  </article>
  
  <article class="card card-content tags-widget">
    <div class="tags-card">
  <div class="tags-header">
    <i 
      class="iconfont icon-biaoqian" 
      style="padding-right: 2px;">
    </i>热门标签
  </div>
  <div class="tags-list">
    
      <a 
        href="/tags/JS%E5%9F%BA%E7%A1%80/" 
        title="JS基础">
        <div class="tags-list-item">JS基础</div>
      </a>
    
      <a 
        href="/tags/CSS%E5%9F%BA%E7%A1%80/" 
        title="CSS基础">
        <div class="tags-list-item">CSS基础</div>
      </a>
    
      <a 
        href="/tags/Node/" 
        title="Node">
        <div class="tags-list-item">Node</div>
      </a>
    
      <a 
        href="/tags/Vue%E5%9F%BA%E7%A1%80/" 
        title="Vue基础">
        <div class="tags-list-item">Vue基础</div>
      </a>
    
      <a 
        href="/tags/%E5%89%8D%E7%AB%AF%E5%B7%A5%E5%85%B7/" 
        title="前端工具">
        <div class="tags-list-item">前端工具</div>
      </a>
    
      <a 
        href="/tags/HTML/" 
        title="HTML">
        <div class="tags-list-item">HTML</div>
      </a>
    
      <a 
        href="/tags/JS%E8%BF%9B%E9%98%B6/" 
        title="JS进阶">
        <div class="tags-list-item">JS进阶</div>
      </a>
    
      <a 
        href="/tags/JS%E5%9F%BA%E7%A1%80%E5%BC%82%E6%AD%A5/" 
        title="JS基础异步">
        <div class="tags-list-item">JS基础异步</div>
      </a>
    
      <a 
        href="/tags/JS%E5%9F%BA%E7%A1%80ES6/" 
        title="JS基础ES6">
        <div class="tags-list-item">JS基础ES6</div>
      </a>
    
      <a 
        href="/tags/CSS%E8%BF%9B%E9%98%B6/" 
        title="CSS进阶">
        <div class="tags-list-item">CSS进阶</div>
      </a>
    
      <a 
        href="/tags/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/" 
        title="前端工程化">
        <div class="tags-list-item">前端工程化</div>
      </a>
    
      <a 
        href="/tags/%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/" 
        title="性能优化">
        <div class="tags-list-item">性能优化</div>
      </a>
    
      <a 
        href="/tags/CSS%E5%92%8CDOM/" 
        title="CSS和DOM">
        <div class="tags-list-item">CSS和DOM</div>
      </a>
    
      <a 
        href="/tags/%E7%A7%BB%E5%8A%A8web/" 
        title="移动web">
        <div class="tags-list-item">移动web</div>
      </a>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
            <main class="main-column">
              
<article class="card card-content">
  <header>
    <h1 class="post-title">
      00-服务器分类及PHP入门
    </h1>
  </header>
  <div class="post-meta post-show-meta">
    <time datetime="2006-05-31T16:00:00.000Z">
      <i 
        class="iconfont icon-calendar" 
        style="margin-right: 2px;">
      </i>
      <span>2006-06-01</span>
    </time>
    
      <span class="dot"></span>
      
        <a 
          href="/categories/JS%E5%9F%BA%E7%A1%80%E5%BC%82%E6%AD%A5/" 
          class="post-meta-link">
          JS基础异步
        </a>
      
    
    
      <span class="dot"></span>
      <span>5.1k 字</span>
    
  </div>
  
    <div 
      class="post-meta post-show-meta" 
      style="margin-top: -10px;">
      <div style="display: flex; align-items: center;">
        <i 
          class="iconfont icon-biaoqian" 
          style="margin-right: 2px; font-size: 1.15rem;">
        </i>
        
          
          <a 
            href="/tags/JS%E5%9F%BA%E7%A1%80%E5%BC%82%E6%AD%A5/" 
            class="post-meta-link">
            JS基础异步
          </a>
        
      </div>
    </div>
  
  </header>
  <div 
    id="section" 
    class="post-content">
    <p><ArticleTopAd></ArticleTopAd></p>
<h2 id="C-x2F-S架构和B-x2F-S架构"><a href="#C-x2F-S架构和B-x2F-S架构" class="headerlink" title="C&#x2F;S架构和B&#x2F;S架构"></a>C&#x2F;S架构和B&#x2F;S架构</h2><h3 id="C-x2F-S架构"><a href="#C-x2F-S架构" class="headerlink" title="C&#x2F;S架构"></a>C&#x2F;S架构</h3><p>是Client&#x2F;Server这两个单词的首字母，指的是客户端，服务器。</p>
<p>优点:</p>
<ul>
<li><p>性能较高：可以将一部分的计算工作放在客户端上,这样服务器只需要处理数据即可。</p>
</li>
<li><p>界面酷炫:客户端可以使用更多系统提供的效果,做出更为炫目的效果。</p>
</li>
</ul>
<p>缺点:</p>
<ul>
<li><p>更新软件：如果有新的功能，就要推出新的版本。</p>
</li>
<li><p>不同设备访问：如果使用其他的电脑，没有安装客户端的话就无法登陆软件。</p>
</li>
</ul>
<h3 id="B-x2F-S架构"><a href="#B-x2F-S架构" class="headerlink" title="B&#x2F;S架构"></a>B&#x2F;S架构</h3><p>是Browser&#x2F;Server的这两个单词的首字母。指的是浏览器、服务器，是WEB兴起之后的一种架构。</p>
<p>现在所有的网站都是B&#x2F;S架构，较为常见的例子有百度、知乎、网易云音乐Web等等，只需要通过浏览器即可使用.</p>
<p>优点：</p>
<ul>
<li><p>更新简洁：如果需要更新内容了,对开发人员而言需要更改服务器的内容，对用户而言只需要刷新浏览器即可。</p>
</li>
<li><p>多设备同步：所有数据都在网上,只要能够使用浏览器即可登录使用。</p>
</li>
</ul>
<p>缺点:</p>
<ul>
<li><p>性能较低：相比于客户端应用性能较低,但是随着硬件性能的提升,这个差距在缩小。</p>
</li>
<li><p>浏览器兼容：处理低版本的浏览器显示问题一直是前端开发人员头痛的问题之一。移动设备兼容性较好，ie6已经越来越少人用了。</p>
</li>
</ul>
<h2 id="服务器分类"><a href="#服务器分类" class="headerlink" title="服务器分类"></a>服务器分类</h2><p>项目开发时，有三套环境：</p>
<ul>
<li><p>Development 开发环境</p>
</li>
<li><p>Test 测试环境</p>
</li>
<li><p>Production 生产环境</p>
</li>
</ul>
<p>程序员平时干活儿用开发环境；开发完成后，部署到测试环境；测试完成后，产品上线，部署到生产环境。</p>
<p>三套环境意味着三个服务器。</p>
<h3 id="服务器类型"><a href="#服务器类型" class="headerlink" title="服务器类型"></a>服务器类型</h3><p>按类型分：</p>
<ul>
<li><p>文件服务器</p>
</li>
<li><p>数据库服务器</p>
</li>
<li><p>邮件服务器</p>
</li>
<li><p>Web 服务器等</p>
</li>
</ul>
<p>按软件分：</p>
<ul>
<li><p>Apache 服务器</p>
</li>
<li><p>Nginx 服务器</p>
</li>
<li><p>IIS 服务器</p>
</li>
<li><p>Tomcat 服务器</p>
</li>
<li><p>Node 服务器等</p>
</li>
</ul>
<p>按操作系统分：</p>
<ul>
<li><p>Linux服务器</p>
</li>
<li><p>Windows服务器等</p>
</li>
</ul>
<h3 id="服务器软件"><a href="#服务器软件" class="headerlink" title="服务器软件"></a>服务器软件</h3><p>提供了某种服务的计算器，我们称之为服务器。那么这些赋予计算器各种服务功能的软件主要有哪一些呢？</p>
<p>常见的服务器软件有：</p>
<ul>
<li><p>文件服务器：Server-U、FileZilla、VsFTP等；</p>
</li>
<li><p>数据库服务器：Oracle、MySQL、PostgreSQL、MSSQL等；</p>
</li>
<li><p>邮件服务器：Postfix、Sendmail等；</p>
</li>
<li><p>HTTP 服务器：Apache（免费、开源）、Nginx、IIS（微软的.net服务器）、Tomcat（java编程的服务器）、NodeJS 等。</p>
</li>
</ul>
<h2 id="使用-WampServer-搭建-HTTP服务"><a href="#使用-WampServer-搭建-HTTP服务" class="headerlink" title="使用 WampServer 搭建 HTTP服务"></a>使用 WampServer 搭建 HTTP服务</h2><h3 id="集成环境的分类"><a href="#集成环境的分类" class="headerlink" title="集成环境的分类"></a>集成环境的分类</h3><ul>
<li><p>AMP：Apache + Mysql + PHP。</p>
</li>
<li><p>WAMP：windows + Apache + Mysql + PHP。</p>
</li>
<li><p>XAMPP：WAMP 是针对windows的，而 XAMPP 可以安装在Linux、Windows、MacOS、Solaris这些操作系统上面。</p>
</li>
</ul>
<p>在windows平台下，如果想要一步到位安装好这些软件，可是使用软件 <strong>WampServer</strong>。</p>
<h3 id="WampServer-的安装"><a href="#WampServer-的安装" class="headerlink" title="WampServer 的安装"></a>WampServer 的安装</h3><p>去 WampServer 的<a target="_blank" rel="noopener" href="http://www.wampserver.com/en/">官网</a>下载软件。</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180227_1936.png" class="lozad post-image"src="http://img.smyhvae.com/20180227_1936.png"></p>
<p>安装完成后进行安装。</p>
<h3 id="测试访问"><a href="#测试访问" class="headerlink" title="测试访问"></a>测试访问</h3><p>打开浏览器输入 <code>127.0.0.1</code> 查看显示的内容，如果是第一次安装，默认显示的应该是如下图片：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180227_2203.png" class="lozad post-image"src="http://img.smyhvae.com/20180227_2203.png"></p>
<p>127.0.0.1 是回送地址，指本地机，一般用来测试使用，如果想要让其他电脑也能够访问，需要进行如下配置：</p>
<p>（1）关闭防火墙：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180227_2207.gif" class="lozad post-image"src="http://img.smyhvae.com/20180227_2207.gif"></p>
<p>（2）修改httpd.conf文件：</p>
<p>因为 Apache 的配置默认不允许外部访问，我们需要修改配置。</p>
<p>打开文件<code>c:\wamp\bin\apache\Apache2.2.21\conf\httpd.conf</code>，通过搜索功能找到<code>onlineoffline tag - don&#39;t remove</code>这句话，在第234行的 <code>Allow from 127.0.0.1</code>的下面，加一行：<code>Allow from all</code>。</p>
<p>然后将第192行的<code>Deny from all</code>改为<code>Allow from all</code>。</p>
<p>保存，然后重启 wamp 即可。</p>
<h3 id="配置网站根目录"><a href="#配置网站根目录" class="headerlink" title="配置网站根目录"></a>配置网站根目录</h3><p>网站的根目录默认是在<code>D:\wamp\www</code>。如果想修改这个根目录，可以这样改：</p>
<p>打开 Apache的配置文件 <code>D:\wamp\bin\apache\Apache2.2.21\conf\http.conf</code>，如果是初次安装，找到178行的<code>DocumentRoot &quot;d:/wamp/www/&quot;</code>，以及205行的<code>&lt;Directory &quot;d:/wamp/www/&quot;&gt;</code>，改这两个位置的路径即可。我们可以通过搜索关键字<code>documentRoot</code>来定位。</p>
<h2 id="静态网站和动态网站"><a href="#静态网站和动态网站" class="headerlink" title="静态网站和动态网站"></a>静态网站和动态网站</h2><p>静态网站：</p>
<ul>
<li><p>访问的是实实在在保存在服务器上的文件。静态资源包括：html页面、css文件、js文件、图片等。</p>
</li>
<li><p>当内容、图片、界面需要更新时，直接修改.html文件。</p>
</li>
</ul>
<p>动态网站：</p>
<ul>
<li><p>当用户访问网站时，根据<code>某些逻辑</code>,动态生成对应的<code>HTML、CSS、JS</code>代码给用户（这也就是web服务器开发的本质）。</p>
</li>
<li><p>通过某种手段，当有新的消息时，<strong>自动</strong>的完成网站的更新。</p>
</li>
</ul>
<p>总结：</p>
<p>由于静态网站在维护的局限性，所以产生了动态网站。</p>
<p>实现动态网站的技术：php&#x2F;jsp&#x2F;.net&#x2F;python等。</p>
<p>动态网站的原理：浏览器请求动态网站的页面（比如*.php），php拼接数据并动态生成html页面，然后将新生成的页面返回给浏览器</p>
<p>php 之所以被称为最好的语言，是因为：基本上，我们能够想到的功能，它都帮助我们封装成了方法。十分方便。</p>
<h2 id="PHP的常见语法"><a href="#PHP的常见语法" class="headerlink" title="PHP的常见语法"></a>PHP的常见语法</h2><p><strong>PHP代码执行方式</strong>：</p>
<ul>
<li><p>在服务器端执行，然后返回给用户结果。如果直接使用浏览器打开，就会解析为文本。</p>
</li>
<li><p>意思是说，需要浏览器通过 http请求，才能够执行php页面。</p>
</li>
</ul>
<p>这里只列举常用的PHP语法，更为详细的语法教程可以查阅 <a target="_blank" rel="noopener" href="http://www.w3school.com.cn/php/index.asp">api 文档</a>。</p>
<h3 id="第一段-php-代码"><a href="#第一段-php-代码" class="headerlink" title="第一段 php 代码"></a>第一段 php 代码</h3><p>将 WampServer 跑起来，在D:\wamp\www下新建一个<code>1.php</code>文件，代码如下：</p>
<p>1.php：</p>
<pre class="highlight"><span class="line">&lt;?php</span><br><span class="line">	echo &quot;hello smyhvae&quot;;</span><br><span class="line">?&gt;</span><br></pre>


<p>在浏览器中输入<code>http://127.0.0.1/2018-02-28/1.php</code>，效果如下：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180228_0910.png" class="lozad post-image"src="http://img.smyhvae.com/20180228_0910.png"></p>
<p><strong>代码的编写位置</strong>：</p>
<p>上方代码中，注意php语言的格式，第一行和第三行的格式中，没有空格。代码的编写位置在<code>&lt;?php 代码写在这里?&gt;</code>。</p>
<h3 id="注释"><a href="#注释" class="headerlink" title="注释"></a>注释</h3><p>php 注释的写法跟 js 一致。</p>
<pre class="highlight"><span class="line">&lt;?php</span><br><span class="line">	//这是单行注释</span><br><span class="line">	/*</span><br><span class="line">		这是多行注释</span><br><span class="line">	*/</span><br><span class="line">?&gt;</span><br></pre>


<h3 id="变量"><a href="#变量" class="headerlink" title="变量"></a>变量</h3><ul>
<li><p>变量以<code>$</code>符号开头，其后是变量的名称。大小写敏感。</p>
</li>
<li><p>变量名称必须以字母或下划线开头。</p>
</li>
</ul>
<p>举例：</p>
<pre class="highlight"><span class="line">$a1;</span><br><span class="line">$_abc;</span><br></pre>

<h3 id="数据类型"><a href="#数据类型" class="headerlink" title="数据类型"></a>数据类型</h3><p>PHP支持的数据类型包括：</p>
<ul>
<li><p>字符串</p>
</li>
<li><p>整数</p>
</li>
<li><p>浮点数</p>
</li>
<li><p>布尔</p>
</li>
<li><p>数组</p>
</li>
<li><p>对象</p>
</li>
<li><p>NULLL</p>
</li>
</ul>
<p>定义字符串时需要注意：</p>
<ul>
<li><p>单引号&#96;&#96; ：内部的内容只是作为字符串。</p>
</li>
<li><p>双引号”” ：如果内部是PHP的变量,那么会将该变量的值解析。如果内部是html代码，也会解析成html。</p>
</li>
</ul>
<p>说白了，单引号里的内容，一定是字符串。双引号里的内容，可能会进行解析。</p>
<pre class="highlight"><span class="line">echo &quot;&lt;input type=`button` value=`smyhvae`&gt;&quot;;</span><br></pre>

<p>上面这个语句，就被会解析成按钮。</p>
<pre class="highlight"><span class="line">// 字符串</span><br><span class="line">$str = &#x27;123&#x27;;</span><br><span class="line"></span><br><span class="line">// 字符串拼接</span><br><span class="line">$str2 = &#x27;123&#x27;.&#x27;哈哈哈&#x27;;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">// 整数</span><br><span class="line">$numA = 1; //正数</span><br><span class="line">$numB = -2;//负数</span><br><span class="line"></span><br><span class="line">// 浮点数</span><br><span class="line">$x = 1.1;</span><br><span class="line"></span><br><span class="line">// 布尔</span><br><span class="line">$a = true;</span><br><span class="line">$b = false;</span><br><span class="line"></span><br><span class="line">// 普通数组：数组中可以放 数字、字符串、布尔值等，不限制类型。</span><br><span class="line">$arr1 = array(&#x27;123&#x27;, 123);</span><br><span class="line">echo $arr1[0];</span><br><span class="line"></span><br><span class="line">// 关系型数组：类似于json格式</span><br><span class="line">$arr2 = $array(`name`=&gt;`smyhvae`, `age`=&gt;`26`);</span><br><span class="line">echo $arr2[`name`];  //获取时，通过  key 来获取</span><br><span class="line"></span><br></pre>

<p>上方代码中注意，php 中字符串拼接的方式是 <code>.</code>。要注意哦。</p>
<h3 id="运算符"><a href="#运算符" class="headerlink" title="运算符"></a>运算符</h3><p>PHP 中的运算符跟 JavaScript 中的基本一致，用法也基本一致。</p>
<ul>
<li><p>算数运算符：<code>+</code>、<code>-</code>、<code>/</code>、<code>*</code>、<code>%</code></p>
</li>
<li><p>赋值运算符：<code>x = y</code>、<code>x += y</code>,<code>x -= y</code>等。</p>
</li>
</ul>
<p>举例：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">	<span class="variable">$x</span> = <span class="number">10</span>;</span><br><span class="line">	<span class="variable">$y</span> = <span class="number">6</span>;</span><br><span class="line"></span><br><span class="line">	<span class="keyword">echo</span> (<span class="variable">$x</span> + <span class="variable">$y</span>); <span class="comment">// 输出 16</span></span><br><span class="line">	<span class="keyword">echo</span> (<span class="variable">$x</span> - <span class="variable">$y</span>); <span class="comment">// 输出 4</span></span><br><span class="line">	<span class="keyword">echo</span> (<span class="variable">$x</span> * <span class="variable">$y</span>); <span class="comment">// 输出 60</span></span><br><span class="line">	<span class="keyword">echo</span> (<span class="variable">$x</span> / <span class="variable">$y</span>); <span class="comment">// 输出 1.6666666666667</span></span><br><span class="line">	<span class="keyword">echo</span> (<span class="variable">$x</span> % <span class="variable">$y</span>); <span class="comment">// 输出 4</span></span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre>

<h3 id="函数的定义"><a href="#函数的定义" class="headerlink" title="函数的定义"></a>函数的定义</h3><p>语法格式：</p>
<pre class="highlight"><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">functionName</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">  <span class="comment">//这里写代码</span></span><br><span class="line">&#125;</span><br></pre>

<p>（1）有参数、无返回值的函数：</p>
<pre class="highlight"><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">sayName</span>(<span class="params"><span class="variable">$name</span></span>)</span>&#123;</span><br><span class="line">    <span class="keyword">echo</span> <span class="variable">$name</span>.<span class="string">&#x27;你好哦&#x27;</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 调用</span></span><br><span class="line"><span class="title function_ invoke__">sayName</span>(<span class="string">&#x27;smyhvae&#x27;</span>);</span><br></pre>

<p>（2）有参数、参数有默认值的函数：</p>
<pre class="highlight"><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">sayFood</span>(<span class="params"><span class="variable">$food</span>=<span class="string">&#x27;西兰花&#x27;</span></span>)</span>&#123;</span><br><span class="line">    <span class="keyword">echo</span> <span class="variable">$food</span>.<span class="string">&#x27;好吃&#x27;</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 调用</span></span><br><span class="line"><span class="title function_ invoke__">sayFood</span>(<span class="string">&#x27;西葫芦&#x27;</span>);<span class="comment">// 如果传入参数,就使用传入的参数</span></span><br><span class="line"><span class="title function_ invoke__">sayFood</span>();<span class="comment">// 如果不传入参数,直接使用默认值</span></span><br></pre>

<p>（3）有参数、有返回值的函数：</p>
<pre class="highlight"><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">sum</span>(<span class="params"><span class="variable">$a</span>,<span class="variable">$b</span></span>)</span>&#123;</span><br><span class="line">	<span class="keyword">return</span> <span class="variable">$a</span>+<span class="variable">$b</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="title function_ invoke__">sum</span>(<span class="number">1</span>,<span class="number">2</span>);<span class="comment">// 返回值为1+2 = 3</span></span><br></pre>

<h3 id="类和对象"><a href="#类和对象" class="headerlink" title="类和对象"></a>类和对象</h3><p>PHP中允许使用对象这种<strong>自定义</strong>的数据类型。必须先声明，实例化之后才能够使用。</p>
<p>定义最基础的类：</p>
<pre class="highlight"><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">Fox</span></span>&#123;</span><br><span class="line"></span><br><span class="line">        <span class="keyword">public</span> <span class="variable">$name</span> = <span class="string">&#x27;itcast&#x27;</span>;</span><br><span class="line">        <span class="keyword">public</span> <span class="variable">$age</span> = <span class="number">10</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="variable">$fox</span> = <span class="keyword">new</span> <span class="variable">$fox</span>;</span><br><span class="line"><span class="comment">// 对象属性取值</span></span><br><span class="line"><span class="variable">$name</span> = <span class="variable">$fox</span>-&gt;name;</span><br><span class="line"><span class="comment">// 对象属性赋值</span></span><br><span class="line"><span class="variable">$fox</span>-&gt;name = <span class="string">&#x27;小狐狸&#x27;</span>;</span><br></pre>


<p>带构造函数的类：</p>
<pre class="highlight"><span class="line"><span class="class"><span class="keyword">class</span> <span class="title">fox</span></span>&#123;</span><br><span class="line">    <span class="comment">// 私有属性,外部无法访问</span></span><br><span class="line">    <span class="keyword">var</span> <span class="variable">$name</span> = <span class="string">&#x27;小狐狸&#x27;</span>;</span><br><span class="line">    <span class="comment">// 定义方法 用来获取属性</span></span><br><span class="line">    <span class="function"><span class="keyword">function</span> <span class="title">Name</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="variable language_">$this</span>-&gt;name;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">// 构造函数,可以传入参数</span></span><br><span class="line">    <span class="function"><span class="keyword">function</span> <span class="title">fox</span>(<span class="params"><span class="variable">$name</span></span>)</span>&#123;</span><br><span class="line">    <span class="variable language_">$this</span>-&gt;name = <span class="variable">$name</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">   <span class="comment">// 定义了构造函数 需要使用构造函数初始化对象</span></span><br><span class="line">   <span class="variable">$fox</span> = <span class="keyword">new</span> <span class="title function_ invoke__">fox</span>(<span class="string">&#x27;小狐狸&#x27;</span>);</span><br><span class="line">   <span class="comment">// 调用对象方法,获取对象名</span></span><br><span class="line">   <span class="variable">$foxName</span> = <span class="variable">$fox</span>-&gt;<span class="title function_ invoke__">Name</span>();</span><br></pre>



<h3 id="内容输出"><a href="#内容输出" class="headerlink" title="内容输出"></a>内容输出</h3><ul>
<li><p><code>echo</code>：输出字符串。</p>
</li>
<li><p><code>print_r()</code>：输出复杂数据类型。比如数组、对象。</p>
</li>
<li><p><code>var_dump()</code>：输出详细信息。</p>
</li>
</ul>
<pre class="highlight"><span class="line"><span class="variable">$arr</span> =<span class="keyword">array</span>(<span class="number">1</span>,<span class="number">2</span>,<span class="string">&#x27;123&#x27;</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">echo</span><span class="string">&#x27;123&#x27;</span>;</span><br><span class="line"><span class="comment">//结果：123</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="title function_ invoke__">print_r</span>(<span class="variable">$arr</span>);</span><br><span class="line"><span class="comment">//结果：Array ( [0] =&gt; 1 [1] =&gt; 2 [2] =&gt; 123 )</span></span><br><span class="line"></span><br><span class="line"><span class="title function_ invoke__">var_dump</span>(<span class="variable">$arr</span>);</span><br><span class="line"><span class="comment">/* 结果：</span></span><br><span class="line"><span class="comment">array</span></span><br><span class="line"><span class="comment">  0 =&gt; int 1</span></span><br><span class="line"><span class="comment">  1 =&gt; int 2</span></span><br><span class="line"><span class="comment">  2 =&gt; string &#x27;123&#x27; (length=3)</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br></pre>

<h3 id="循环语句"><a href="#循环语句" class="headerlink" title="循环语句"></a>循环语句</h3><p>这里只列举了<code>foreach</code>、<code>for</code>循环。</p>
<p>for 循环：</p>
<pre class="highlight"><span class="line"><span class="keyword">for</span> (<span class="variable">$x</span>=<span class="number">0</span>; <span class="variable">$x</span>&lt;=<span class="number">10</span>; <span class="variable">$x</span>++) &#123;</span><br><span class="line">  <span class="keyword">echo</span> <span class="string">&quot;数字是：<span class="subst">$x</span> &lt;br&gt;&quot;</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre>


<p>foreach 循环：</p>
<pre class="highlight"><span class="line"><span class="variable">$colors</span> = <span class="keyword">array</span>(<span class="string">&quot;red&quot;</span>,<span class="string">&quot;green&quot;</span>,<span class="string">&quot;blue&quot;</span>,<span class="string">&quot;yellow&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="keyword">foreach</span> (<span class="variable">$colors</span> <span class="keyword">as</span> <span class="variable">$value</span>) &#123;</span><br><span class="line">  <span class="keyword">echo</span> <span class="string">&quot;<span class="subst">$value</span> &lt;br&gt;&quot;</span>;</span><br><span class="line">&#125;</span><br></pre>

<p>上方代码中，参数一：循环的对象。参数二：将对象的值挨个取出，直到最后。</p>
<p>如果循环的是对象，输出的是对象的属性的值。</p>
<p>输出结果：</p>
<pre class="highlight"><span class="line">red</span><br><span class="line">green</span><br><span class="line">blue</span><br><span class="line">yellow</span><br></pre>


<h2 id="php中的header-函数"><a href="#php中的header-函数" class="headerlink" title="php中的header()函数"></a>php中的header()函数</h2><p>浏览器访问http服务器，接收到响应时，会根据响应<strong>报文头</strong>的内容进行一些具体的操作。在php中，我们可以根据 <strong>header</strong> 来设置这些内容。</p>
<p><strong>header()函数的作用</strong>：用来向客户端(浏览器)发送报头。直接写在php代码的第一行就行。</p>
<p>下面列举几个常见的 header函数。</p>
<p>（1）设置编码格式：</p>
<pre class="highlight"><span class="line"><span class="title function_ invoke__">header</span>(<span class="string">&#x27;content-type:text/html; charset= utf-8&#x27;</span>);</span><br></pre>

<p>例如：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">	<span class="title function_ invoke__">header</span>(<span class="string">&#x27;content-type:text/html; charset= utf-8&#x27;</span>);</span><br><span class="line">	<span class="keyword">echo</span> <span class="string">&quot;我的第一段 PHP 脚本&quot;</span>;</span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre>

<p>（2）设置页面跳转：</p>
<pre class="highlight"><span class="line"><span class="title function_ invoke__">header</span>(<span class="string">&#x27;location:http://www.baidu.com&#x27;</span>);</span><br></pre>


<p>设置页面刷新的间隔：</p>
<pre class="highlight"><span class="line"><span class="title function_ invoke__">header</span>(<span class="string">&#x27;refresh:3; url=http://www.xiaomi.com&#x27;</span>);</span><br></pre>


<h2 id="php中的-get-请求和-post-请求"><a href="#php中的-get-请求和-post-请求" class="headerlink" title="php中的 get 请求和 post 请求"></a>php中的 get 请求和 post 请求</h2><h3 id="get-请求"><a href="#get-请求" class="headerlink" title="get 请求"></a>get 请求</h3><p>可以通过<code>$_GET</code>对象来获取。</p>
<p><strong>举例</strong>：下面是一个简单的表单代码，通过 get 请求将数据提交到01.php。</p>
<p>（1）index.html:</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>Title<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 通过 get 请求，将表单提交到 php 页面中 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">form</span> <span class="attr">action</span>=<span class="string">&quot;01.php&quot;</span> <span class="attr">method</span>=<span class="string">&quot;get&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;&quot;</span>&gt;</span>姓名：</span><br><span class="line">        <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">name</span>=<span class="string">&quot;userName&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">br</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;&quot;</span>&gt;</span>邮箱：</span><br><span class="line">        <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">name</span>=<span class="string">&quot;userEmail&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">br</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;submit&quot;</span> <span class="attr">name</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre>

<p>（2）01.php：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">	<span class="title function_ invoke__">header</span>(<span class="string">&#x27;content-type:text/html; charset= utf-8&#x27;</span>);</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&quot;&lt;h1&gt;php 的get 请求演示&lt;/h1&gt;&quot;</span>;</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&#x27;用户名：&#x27;</span>.<span class="variable">$_GET</span>[<span class="string">&#x27;userName&#x27;</span>];</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&#x27;&lt;br/&gt;&#x27;</span>;</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&#x27;邮箱：&#x27;</span>.<span class="variable">$_GET</span>[<span class="string">&#x27;userEmail&#x27;</span>];</span><br><span class="line"> <span class="meta">?&gt;</span></span><br></pre>

<p>上方代码可以看出，<code>$_GET</code>是关系型数组，可以通过 **$_GET[<code>key</code>]**获取值。这里的 key 是 form 标签中表单元素的 name 属性的值。</p>
<p>效果：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180228_1140.gif" class="lozad post-image"src="http://img.smyhvae.com/20180228_1140.gif"></p>
<h3 id="post-请求"><a href="#post-请求" class="headerlink" title="post 请求"></a>post 请求</h3><p>可以通过<code>$_POST</code>对象来获取。</p>
<p><strong>举例</strong>：下面是一个简单的表单代码，通过 post 请求将数据提交到02.php。</p>
<p>（1）index.html：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">&quot;en&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>Title<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 通过 post 请求，将表单提交到 php 页面中 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">form</span> <span class="attr">action</span>=<span class="string">&quot;02.php&quot;</span> <span class="attr">method</span>=<span class="string">&quot;post&quot;</span> &gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;&quot;</span>&gt;</span>姓名：</span><br><span class="line">      <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">name</span>= <span class="string">&quot;userName&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">br</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;&quot;</span>&gt;</span>邮箱：</span><br><span class="line">      <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">name</span>= <span class="string">&quot;userEmail&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">br</span>/&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;submit&quot;</span> <span class="attr">name</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre>

<p>（2）02.php：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">	<span class="title function_ invoke__">header</span>(<span class="string">&#x27;content-type:text/html; charset= utf-8&#x27;</span>);</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&quot;&lt;h1&gt;php 的 post 请求演示&lt;/h1&gt;&quot;</span>;</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&#x27;用户名：&#x27;</span>.<span class="variable">$_POST</span>[<span class="string">&#x27;userName&#x27;</span>];</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&#x27;&lt;br/&gt;&#x27;</span>;</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&#x27;邮箱：&#x27;</span>.<span class="variable">$_POST</span>[<span class="string">&#x27;userEmail&#x27;</span>];</span><br><span class="line"> <span class="meta">?&gt;</span></span><br></pre>

<p>上方代码可以看出，<code>$_POST</code>是关系型数组，可以通过 **$_POST[<code>key</code>]**获取值。这里的 key 是 form 标签中表单元素的 name 属性的值。</p>
<p>效果演示：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180228_1145.gif" class="lozad post-image"src="http://img.smyhvae.com/20180228_1145.gif"></p>
<p>实际开发中，可能不会单独写一个php文件，常见的做法是：在 html 文件中嵌入 php 的代码。</p>
<p>比如说，原本 html 中有个 li 标签是存放用户名的：</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">li</span>&gt;</span>smyhvae<span class="tag">&lt;/<span class="name">li</span>&gt;</span></span><br></pre>

<p>嵌入 php后，用户名就变成了动态获取的：</p>
<pre class="highlight"><span class="line">&lt;li&gt;<span class="meta">&lt;?php</span></span><br><span class="line">	<span class="keyword">echo</span> <span class="variable">$_POST</span>[`userName`]</span><br><span class="line">	<span class="meta">?&gt;</span>&lt;/li&gt;</span><br></pre>

<h2 id="php-中文件相关的操作"><a href="#php-中文件相关的操作" class="headerlink" title="php 中文件相关的操作"></a>php 中文件相关的操作</h2><h3 id="文件上传-FILES"><a href="#文件上传-FILES" class="headerlink" title="文件上传 $_FILES"></a>文件上传 <code>$_FILES</code></h3><p>上传文件时，需要在html代码中进行如下设置：</p>
<p>（1）在html表单中，设置<code>enctype=&quot;multipart/form-data&quot;</code>。该值是必须的。</p>
<p>（2）只能用 post 方式获取。</p>
<p>代码如下：</p>
<p>（1）index.html:</p>
<pre class="highlight"><span class="line"><span class="tag">&lt;<span class="name">form</span> <span class="attr">action</span>=<span class="string">&quot;03-fileUpdate.php&quot;</span> <span class="attr">method</span>=<span class="string">&quot;post&quot;</span> <span class="attr">enctype</span>=<span class="string">&quot;multipart/form-data&quot;</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">&quot;&quot;</span>&gt;</span>照片:</span><br><span class="line">     <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;file&quot;</span> <span class="attr">name</span> = <span class="string">&quot;picture&quot;</span> <span class="attr">multiple</span>=<span class="string">&quot;&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">label</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">br</span>/&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;submit&quot;</span> <span class="attr">name</span>=<span class="string">&quot;&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form</span>&gt;</span></span><br><span class="line"></span><br></pre>

<p>（2）在 php 文件中打印 file 的具体内容：</p>
<pre class="highlight"><span class="line"><span class="meta">&lt;?php</span></span><br><span class="line">  <span class="title function_ invoke__">sleep</span>(<span class="number">5</span>);<span class="comment">// 让服务器休息一会</span></span><br><span class="line">  <span class="title function_ invoke__">print_r</span>(<span class="variable">$_FILES</span>);  <span class="comment">//打印 file 的具体内容</span></span><br><span class="line"><span class="meta">?&gt;</span></span><br></pre>

<p>演示效果：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180228_php_post_file.gif" class="lozad post-image"src="http://img.smyhvae.com/20180228_php_post_file.gif"></p>
<p>上方现象可以看出：</p>
<ul>
<li><p>点击提交后，服务器没有立即出现反应,而是休息了一会<code>sleep(5)</code>。</p>
</li>
<li><p>在<code>wamp/tmp</code>目录下面出现了一个<code>.tmp</code>文件。</p>
</li>
<li><p>.tmp文件一会就被自动删除了。</p>
</li>
<li><p>服务器返回的内容中有文件的名字<code>[name] =&gt; computer.png</code>，以及上传文件保存的位置<code>D:\wamp\tmp\php3D70.tmp</code>。服务器返回的内容如下：</p>
</li>
</ul>
<pre class="highlight"><span class="line">Array ( [upFile] =&gt; Array ( [name] =&gt; yangyang.jpg [<span class="built_in">type</span>] =&gt; image/jpeg [tmp_name] =&gt; D:\wamp\tmp\phpCC56.tmp [error] =&gt; 0 [size] =&gt; 18145 ) )</span><br></pre>

<h3 id="文件保存"><a href="#文件保存" class="headerlink" title="文件保存"></a>文件保存</h3><p>我们尝试一下，把上面的例子中的<code>临时目录</code>下面的文件保存起来。这里需要用到 php 里的 <code>move_uploaded_file()</code>函数。<a target="_blank" rel="noopener" href="http://www.w3school.com.cn/php/func_filesystem_move_uploaded_file.asp">#</a></p>
<p>格式如下：</p>
<pre class="highlight"><span class="line"><span class="title function_ invoke__">move_uploaded_file</span>(<span class="variable">$_FILES</span>[<span class="string">&#x27;photo&#x27;</span>][<span class="string">&#x27;tmp_name&#x27;</span>], <span class="string">&#x27;./images/test.jpg&#x27;</span>);</span><br></pre>

<p>参数解释：参数一：移动的文件。参数二：目标路径。</p>
<p>（1）index.html：（这部分的代码保持不变）</p>
<pre class="highlight"><span class="line">&lt;form action=<span class="string">&quot;03.fileUpdate.php&quot;</span> method=<span class="string">&quot;post&quot;</span> enctype=<span class="string">&quot;multipart/form-data&quot;</span>&gt;</span><br><span class="line">     &lt;label <span class="keyword">for</span>=<span class="string">&quot;&quot;</span>&gt;照片:</span><br><span class="line">         &lt;input type=<span class="string">&quot;file&quot;</span> name = <span class="string">&quot;picture&quot;</span> multiple=<span class="string">&quot;&quot;</span>&gt;&lt;/label&gt;</span><br><span class="line">     &lt;br/&gt;</span><br><span class="line">     &lt;input type=<span class="string">&quot;submit&quot;</span> name=<span class="string">&quot;&quot;</span>&gt;</span><br><span class="line"> 	&lt;/form&gt;</span><br></pre>


<p>（2）PHP代码：</p>
<p>暂略。</p>
<h3 id="WampServer-中修改上传文件的大小"><a href="#WampServer-中修改上传文件的大小" class="headerlink" title="WampServer 中修改上传文件的大小"></a>WampServer 中修改上传文件的大小</h3><p>（1）打开 WampServer的文件<code>php.ini</code>：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180228_1454.png" class="lozad post-image"src="http://img.smyhvae.com/20180228_1454.png"></p>
<p>（2）修改<code>php.ini</code>中的如下内容：</p>
<p>设置文件最大上传限制：（值的大小可以根据需求修改）</p>
<pre class="highlight"><span class="line">file_uploads = On;         是否允许上传文件 On/Off 默认是On</span><br><span class="line">upload_max_filesize = <span class="number">32</span>M; 设置 上传文件的最大限制</span><br><span class="line">post_max_size = <span class="number">32</span>M;       设置 通过Post提交的最多数据</span><br></pre>


<p>考虑网络传输快慢：这里修改一些参数：</p>
<pre class="highlight"><span class="line">max_execution_time = <span class="number">30000</span>      ; 脚本最长的执行时间 单位为秒</span><br><span class="line">max_input_time = <span class="number">600</span>            ; 接收提交的数据的时间限制 单位为秒</span><br><span class="line">memory_limit = <span class="number">1024</span>M            ; 最大的内存消耗</span><br></pre>

<h2 id="HTTP-协议"><a href="#HTTP-协议" class="headerlink" title="HTTP 协议"></a>HTTP 协议</h2><h3 id="请求"><a href="#请求" class="headerlink" title="请求"></a>请求</h3><p>客户端发出的请求，主要由三个组成部分：请求行、请求头、请求主体。如下图所示：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://img.smyhvae.com/20180228_1505.jpg" class="lozad post-image"src="https://img.smyhvae.com/20180228_1505.jpg"></p>
<p><strong>1、请求行：</strong></p>
<ul>
<li><p>请求方法：GET or POST</p>
</li>
<li><p>请求URL</p>
</li>
<li><p>HTTP协议版本</p>
</li>
</ul>
<p><strong>2、请求头：</strong></p>
<p>常见的请求头如下：</p>
<pre class="highlight"><span class="line">User-Agent：浏览器的具体类型　　如：User-Agent：Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0</span><br><span class="line"></span><br><span class="line">Accept：浏览器支持哪些数据类型　　如：Accept: text/html,application/xhtml+xml,application/xml;q=0.9;</span><br><span class="line"></span><br><span class="line">Accept-Charset：浏览器采用的是哪种编码　　如：Accept-Charset: ISO-8859-1</span><br><span class="line"></span><br><span class="line">Accept-Encoding：浏览器支持解码的数据压缩格式　　如：Accept-Encoding: gzip, deflate</span><br><span class="line"></span><br><span class="line">Accept-Language：浏览器的语言环境　　如：Accept-Language zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3</span><br><span class="line"></span><br><span class="line">Host：请求的主机名，允许多个域名同处一个IP地址，即虚拟主机。Host:www.baidu.com</span><br><span class="line"></span><br><span class="line">Connection：表示是否需要持久连接。</span><br><span class="line">属性值可以是Keep-Alive/close，HTTP1.1默认是持久连接，它可以利用持久连接的优点，当页面包含多个元素时（例如Applet，图片），显著地减少下载所需要的时间。</span><br><span class="line">要实现这一点，Servlet需要在应答中发送一个Content-Length头，最简单的实现方法是：先把内容写入ByteArrayOutputStream，然后在正式写出内容之前计算它的大小。如：Connection: Keep-Alive</span><br><span class="line"></span><br><span class="line">Content-Length：表示请求消息正文的长度。对于POST请求来说Content-Length必须出现。</span><br><span class="line"></span><br><span class="line">Content-Type：WEB服务器告诉浏览器自己响应的对象的类型和字符集。例如：Content-Type: text/html; charset=<span class="string">&#x27;gb2312&#x27;</span></span><br><span class="line"></span><br><span class="line">Content-Encoding：WEB服务器表明自己使用了什么压缩方法（gzip，deflate）压缩响应中的对象。例如：Content-Encoding：gzip</span><br><span class="line"></span><br><span class="line">Content-Language：WEB服务器告诉浏览器自己响应的对象的语言。</span><br><span class="line"></span><br><span class="line">Cookie：最常用的请求头，浏览器每次都会将cookie发送到服务器上，允许服务器在客户端存储少量数据。</span><br><span class="line"></span><br><span class="line">Referer：包含一个URL，用户从该URL代表的页面出发访问当前请求的页面。服务器能知道你是从哪个页面过来的。Referer: http://www.baidu.com/</span><br><span class="line"></span><br></pre>

<p><strong>3、请求体：</strong></p>
<p>指的是提交给服务器的数据。</p>
<p>需要注意的是，如果是往服务器提交数据，需要在请求头中设置<code>Content-Type: application/x-www-form-urlencoded</code>(在ajax中需要手动设置)。</p>
<h3 id="响应"><a href="#响应" class="headerlink" title="响应"></a>响应</h3><p>响应报文是服务器返回给客户端的。组成部分有响应行、响应头、响应主体。</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="http://img.smyhvae.com/20180228_1510.jpg" class="lozad post-image"src="http://img.smyhvae.com/20180228_1510.jpg"></p>
<p><strong>1、状态行：</strong></p>
<p>HTTP响应行：主要是设置响应状态等信息。</p>
<p><strong>2、响应头：</strong></p>
<p>Cookie、缓存等信息就是在响应头的属性中设置的。</p>
<p>常见的响应头如下：</p>
<pre class="highlight"><span class="line">Cache-Control</span><br><span class="line"></span><br><span class="line">响应输出到客户端后，服务端通过该报文头属告诉客户端如何控制响应内容的缓存。</span><br><span class="line"></span><br><span class="line">下面，的设置让客户端对响应内容缓存3600秒，也即在3600秒内，如果客户再次访问该资源，直接从客户端的缓存中返回内容给客户，不要再从服务端获取（当然，这个功能是靠客户端实现的，服务端只是通过这个属性提示客户端“应该这么做”，做不做，还是决定于客户端，如果是自己宣称支持HTTP的客户端，则就应该这样实现）。</span><br><span class="line"></span><br><span class="line">Cache-Control: max-age=3600</span><br><span class="line"></span><br><span class="line">ETag</span><br><span class="line"></span><br><span class="line">一个代表响应服务端资源（如页面）版本的报文头属性，如果某个服务端资源发生变化了，这个ETag就会相应发生变化。它是Cache-Control的有益补充，可以让客户端“更智能”地处理什么时候要从服务端取资源，什么时候可以直接从缓存中返回响应。</span><br><span class="line"></span><br><span class="line">ETag: <span class="string">&quot;737060cd8c284d8af7ad3082f209582d&quot;</span></span><br><span class="line"></span><br><span class="line">Location</span><br><span class="line"></span><br><span class="line">我们在Asp.net中让页面Redirect到一个某个A页面中，其实是让客户端再发一个请求到A页面，这个需要Redirect到的A页面的URL，其实就是通过响应报文头的Location属性告知客户端的，如下的报文头属性，将使客户端redirect到iteye的首页中：</span><br><span class="line"></span><br><span class="line">Location: http://www.google.com.hk</span><br><span class="line"></span><br><span class="line">Set-Cookie</span><br><span class="line"></span><br><span class="line">服务端可以设置客户端的Cookie，其原理就是通过这个响应报文头属性实现的。</span><br><span class="line"></span><br><span class="line">Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1</span><br><span class="line"></span><br><span class="line"></span><br></pre>


<p><strong>3、HTTP响应体：</strong></p>
<p>如果请求的是HTML页面，那么返回的就是HTML代码。如果是JS就是JS代码。</p>
<h3 id="抓包工具"><a href="#抓包工具" class="headerlink" title="抓包工具"></a>抓包工具</h3><p>常见的抓包工具有：whistle、Fiddler、Charles。</p>

  </div>
  <div>
    
      <div 
        class="post-note note-warning copyright" 
        style="margin-top: 42px">
        <p>
          <span style="font-weight: bold;">作者：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="/about">
            zwl5670
          </a>
        </p>
        <p>
          <span style="font-weight: bold;">文章链接：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="https://zwl5670.gitee.io/2006/06/01/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/00-%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB%E5%8F%8APHP%E5%85%A5%E9%97%A8/">
            https://zwl5670.gitee.io/2006/06/01/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/00-%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB%E5%8F%8APHP%E5%85%A5%E9%97%A8/
          </a>
        </p>
        <p><span style="font-weight: bold;">版权声明：</span>本博客所有文章除特别声明外，均采用<a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA 4.0 协议</a>。转载请注明出处！</p>
      </div>
    
  </div>
</article>
<div class="nav">
  
    <div class="nav-item-prev">
      <a 
        href="/2006/06/01/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/01-%E5%8D%95%E7%BA%BF%E7%A8%8B%E5%92%8C%E5%BC%82%E6%AD%A5/" 
        class="nav-link">
        <i class="iconfont icon-left nav-prev-icon"></i>
        <div>
          <div class="nav-label">上一篇</div>
          
            <div class="nav-title">01-单线程和异步 </div>
          
        </div>
      </a>
    </div>
  
  
    <div class="nav-item-next">
      <a 
        href="/2006/06/01/06-JavaScript%E5%9F%BA%E7%A1%80%EF%BC%9A%E5%BC%82%E6%AD%A5%E7%BC%96%E7%A8%8B/02-Ajax%E5%85%A5%E9%97%A8%E5%92%8C%E5%8F%91%E9%80%81http%E8%AF%B7%E6%B1%82/" 
        class="nav-link">
        <div>
          <div class="nav-label">下一篇</div>
          
            <div class="nav-title">02-Ajax入门和发送http请求 </div>
          
        </div>
        <i class="iconfont icon-right nav-next-icon"></i>
      </a>
    </div>
  
</div>

<div 
  class="card card-content toc-card" 
  id="mobiletoc">
  <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#C-x2F-S%E6%9E%B6%E6%9E%84%E5%92%8CB-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">C&#x2F;S架构和B&#x2F;S架构</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#C-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">C&#x2F;S架构</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#B-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">B&#x2F;S架构</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB"><span class="toc-text">服务器分类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%B1%BB%E5%9E%8B"><span class="toc-text">服务器类型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%BD%AF%E4%BB%B6"><span class="toc-text">服务器软件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-WampServer-%E6%90%AD%E5%BB%BA-HTTP%E6%9C%8D%E5%8A%A1"><span class="toc-text">使用 WampServer 搭建 HTTP服务</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%9B%86%E6%88%90%E7%8E%AF%E5%A2%83%E7%9A%84%E5%88%86%E7%B1%BB"><span class="toc-text">集成环境的分类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#WampServer-%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-text">WampServer 的安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95%E8%AE%BF%E9%97%AE"><span class="toc-text">测试访问</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E7%BD%91%E7%AB%99%E6%A0%B9%E7%9B%AE%E5%BD%95"><span class="toc-text">配置网站根目录</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%9D%99%E6%80%81%E7%BD%91%E7%AB%99%E5%92%8C%E5%8A%A8%E6%80%81%E7%BD%91%E7%AB%99"><span class="toc-text">静态网站和动态网站</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#PHP%E7%9A%84%E5%B8%B8%E8%A7%81%E8%AF%AD%E6%B3%95"><span class="toc-text">PHP的常见语法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%AC%AC%E4%B8%80%E6%AE%B5-php-%E4%BB%A3%E7%A0%81"><span class="toc-text">第一段 php 代码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B3%A8%E9%87%8A"><span class="toc-text">注释</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%98%E9%87%8F"><span class="toc-text">变量</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="toc-text">数据类型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%90%E7%AE%97%E7%AC%A6"><span class="toc-text">运算符</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%87%BD%E6%95%B0%E7%9A%84%E5%AE%9A%E4%B9%89"><span class="toc-text">函数的定义</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%B1%BB%E5%92%8C%E5%AF%B9%E8%B1%A1"><span class="toc-text">类和对象</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%86%85%E5%AE%B9%E8%BE%93%E5%87%BA"><span class="toc-text">内容输出</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5"><span class="toc-text">循环语句</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php%E4%B8%AD%E7%9A%84header-%E5%87%BD%E6%95%B0"><span class="toc-text">php中的header()函数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php%E4%B8%AD%E7%9A%84-get-%E8%AF%B7%E6%B1%82%E5%92%8C-post-%E8%AF%B7%E6%B1%82"><span class="toc-text">php中的 get 请求和 post 请求</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#get-%E8%AF%B7%E6%B1%82"><span class="toc-text">get 请求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#post-%E8%AF%B7%E6%B1%82"><span class="toc-text">post 请求</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php-%E4%B8%AD%E6%96%87%E4%BB%B6%E7%9B%B8%E5%85%B3%E7%9A%84%E6%93%8D%E4%BD%9C"><span class="toc-text">php 中文件相关的操作</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0-FILES"><span class="toc-text">文件上传 $_FILES</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%BF%9D%E5%AD%98"><span class="toc-text">文件保存</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#WampServer-%E4%B8%AD%E4%BF%AE%E6%94%B9%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6%E7%9A%84%E5%A4%A7%E5%B0%8F"><span class="toc-text">WampServer 中修改上传文件的大小</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTTP-%E5%8D%8F%E8%AE%AE"><span class="toc-text">HTTP 协议</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AF%B7%E6%B1%82"><span class="toc-text">请求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%93%8D%E5%BA%94"><span class="toc-text">响应</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8A%93%E5%8C%85%E5%B7%A5%E5%85%B7"><span class="toc-text">抓包工具</span></a></li></ol></li></ol>
</div>
            </main>
            <aside class="right-column">
              <div class="sticky-widescreen">
  
  
    <article class="card card-content toc-card">
      <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#C-x2F-S%E6%9E%B6%E6%9E%84%E5%92%8CB-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">C&#x2F;S架构和B&#x2F;S架构</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#C-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">C&#x2F;S架构</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#B-x2F-S%E6%9E%B6%E6%9E%84"><span class="toc-text">B&#x2F;S架构</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%88%86%E7%B1%BB"><span class="toc-text">服务器分类</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%B1%BB%E5%9E%8B"><span class="toc-text">服务器类型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%BD%AF%E4%BB%B6"><span class="toc-text">服务器软件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8-WampServer-%E6%90%AD%E5%BB%BA-HTTP%E6%9C%8D%E5%8A%A1"><span class="toc-text">使用 WampServer 搭建 HTTP服务</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%9B%86%E6%88%90%E7%8E%AF%E5%A2%83%E7%9A%84%E5%88%86%E7%B1%BB"><span class="toc-text">集成环境的分类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#WampServer-%E7%9A%84%E5%AE%89%E8%A3%85"><span class="toc-text">WampServer 的安装</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95%E8%AE%BF%E9%97%AE"><span class="toc-text">测试访问</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E7%BD%91%E7%AB%99%E6%A0%B9%E7%9B%AE%E5%BD%95"><span class="toc-text">配置网站根目录</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%9D%99%E6%80%81%E7%BD%91%E7%AB%99%E5%92%8C%E5%8A%A8%E6%80%81%E7%BD%91%E7%AB%99"><span class="toc-text">静态网站和动态网站</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#PHP%E7%9A%84%E5%B8%B8%E8%A7%81%E8%AF%AD%E6%B3%95"><span class="toc-text">PHP的常见语法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%AC%AC%E4%B8%80%E6%AE%B5-php-%E4%BB%A3%E7%A0%81"><span class="toc-text">第一段 php 代码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B3%A8%E9%87%8A"><span class="toc-text">注释</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8F%98%E9%87%8F"><span class="toc-text">变量</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="toc-text">数据类型</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%90%E7%AE%97%E7%AC%A6"><span class="toc-text">运算符</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%87%BD%E6%95%B0%E7%9A%84%E5%AE%9A%E4%B9%89"><span class="toc-text">函数的定义</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%B1%BB%E5%92%8C%E5%AF%B9%E8%B1%A1"><span class="toc-text">类和对象</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%86%85%E5%AE%B9%E8%BE%93%E5%87%BA"><span class="toc-text">内容输出</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5"><span class="toc-text">循环语句</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php%E4%B8%AD%E7%9A%84header-%E5%87%BD%E6%95%B0"><span class="toc-text">php中的header()函数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php%E4%B8%AD%E7%9A%84-get-%E8%AF%B7%E6%B1%82%E5%92%8C-post-%E8%AF%B7%E6%B1%82"><span class="toc-text">php中的 get 请求和 post 请求</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#get-%E8%AF%B7%E6%B1%82"><span class="toc-text">get 请求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#post-%E8%AF%B7%E6%B1%82"><span class="toc-text">post 请求</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#php-%E4%B8%AD%E6%96%87%E4%BB%B6%E7%9B%B8%E5%85%B3%E7%9A%84%E6%93%8D%E4%BD%9C"><span class="toc-text">php 中文件相关的操作</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0-FILES"><span class="toc-text">文件上传 $_FILES</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E4%BB%B6%E4%BF%9D%E5%AD%98"><span class="toc-text">文件保存</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#WampServer-%E4%B8%AD%E4%BF%AE%E6%94%B9%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6%E7%9A%84%E5%A4%A7%E5%B0%8F"><span class="toc-text">WampServer 中修改上传文件的大小</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HTTP-%E5%8D%8F%E8%AE%AE"><span class="toc-text">HTTP 协议</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%AF%B7%E6%B1%82"><span class="toc-text">请求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%93%8D%E5%BA%94"><span class="toc-text">响应</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8A%93%E5%8C%85%E5%B7%A5%E5%85%B7"><span class="toc-text">抓包工具</span></a></li></ol></li></ol>
    </article>
  
  
  <article class="card card-content">
    <div class="recent-posts-card">
  <div class="recent-posts-header">
    <i 
      class="iconfont icon-wenzhang_huaban" 
      style="padding-right: 2px;">
    </i>最近文章
  </div>
  <div class="recent-posts-list">
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/11-React%20Navive%E5%88%9D%E8%AF%86/"><div class="recent-posts-item-content">11-React Navive初识</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/10-AntD%E6%A1%86%E6%9E%B6%E7%9A%84upload%E7%BB%84%E4%BB%B6%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87%E6%97%B6%E4%BD%BF%E7%94%A8customRequest%E6%96%B9%E6%B3%95%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8A%E4%BC%A0%E8%A1%8C%E4%B8%BA/"><div class="recent-posts-item-content">10-AntD框架的upload组件上传图片时使用customRequest方法自定义上传行为</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/09-AntD%E6%A1%86%E6%9E%B6%E7%9A%84upload%E7%BB%84%E4%BB%B6%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87%E6%97%B6%E9%81%87%E5%88%B0%E7%9A%84%E4%B8%80%E4%BA%9B%E5%9D%91/"><div class="recent-posts-item-content">09-AntD框架的upload组件上传图片时遇到的一些坑</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2023-03-09</div>
        <a href="/2023/03/09/13-React%E5%9F%BA%E7%A1%80/08-Ant%20Design%E7%9A%84%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8/"><div class="recent-posts-item-content">08-Ant Design的基本使用</div></a>
      </div>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
          </div>
        </div>
      </div>
    </div>
     
    <footer class="footer">
  <div class="footer-container">
    <div>
      <div class="footer-dsc">
        <span>
          Copyright ©
          
            2023
          
          
        </span>
        &nbsp;
        <a 
          href="/" 
          class="footer-link">
          前端面试
        </a>
      </div>
    </div>

    
      <div class="footer-dsc">
        
          Powered by
          <a 
            href="https://hexo.io/" 
            class="footer-link" 
            target="_blank" 
            rel="nofollow noopener noreferrer">
            &nbsp;Hexo
          </a>
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          Theme -
          <a 
            href="https://github.com/theme-kaze" 
            class="footer-link" 
            target="_blank"
            rel="nofollow noopener noreferrer">
            &nbsp;Kaze
          </a>
        
      </div>
    
    
    
    
</footer>
 
    
  <a 
    role="button" 
    id="scrollbutton" 
    class="basebutton" 
    aria-label="回到顶部">
    <i class="iconfont icon-arrowleft button-icon"></i>
  </a>

<a 
  role="button" 
  id="menubutton"
  aria-label="menu button"
  class="basebutton">
  <i class="iconfont icon-menu button-icon"></i>
</a>
<a 
  role="button" 
  id="popbutton" 
  class="basebutton" 
  aria-label="控制中心">
  <i class="iconfont icon-expand button-icon"></i>
</a>
<a 
  role="button" 
  id="darkbutton" 
  class="basebutton darkwidget" 
  aria-label="夜色模式">
  <i class="iconfont icon-weather button-icon"></i>
</a>
<a 
  role="button" 
  id="searchbutton" 
  class="basebutton searchwidget" 
  aria-label="搜索">
  <i class="iconfont icon-search button-icon"></i>
</a> 
     
     
     
      <script>
  var addImgLayout = function () {
    var img = document.querySelectorAll('.post-content img')
    var i
    for (i = 0; i < img.length; i++) {
      var wrapper = document.createElement('a')
      wrapper.setAttribute('href', img[i].getAttribute('data-src'))
      wrapper.setAttribute('aria-label', 'illustration')
      wrapper.style.cssText =
        'width: 100%; display: flex; justify-content: center;'
      if (img[i].alt) wrapper.dataset.caption = img[i].alt
      wrapper.dataset.nolink = true
      img[i].before(wrapper)
      wrapper.append(img[i])
      var divWrap = document.createElement('div')
      divWrap.classList.add('gallery')
      wrapper.before(divWrap)
      divWrap.append(wrapper)
    }
    baguetteBox.run('.gallery')
  }
</script>
<script>
  loadScript(
    "/js/lib/lightbox/baguetteBox.min.js",
    addImgLayout
  )
</script>
 
     
     
    <script src="/js/main.js"></script> 
     
    
      <script>
        var addLazyload = function () {
          var observer = lozad('.lozad', {
            load: function (el) {
              el.srcset = el.getAttribute('data-src')
            },
            loaded: function (el) {
              el.classList.add('loaded')
            },
          })
          observer.observe()
        }
      </script>
      <script>
        loadScript('/js/lib/lozad.min.js', addLazyload)
      </script>
    
    <script src="//instant.page/5.1.0" type="module"
      integrity="sha384-by67kQnR+pyfy8yWP4kPO12fHKRLHZPfEsiSXR8u2IKcTdxD805MGUXBzVPnkLHw"></script>
    
    
  </body>
</html>
